<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模型语料查询</title>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>

    <style>
        /* 原有导航栏样式保持不变 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html,
        body {
            width: 100%;
            height: 100%;
            font-family: 'Poppins', sans-serif;
            background: linear-gradient(135deg, #e0f7fa, #f4f4f9);
        }

        .container .navbar {
            width: 100%;
            height: 80px;
            background: linear-gradient(45deg, #0084ff, #00c3ff);
            display: flex;
            align-items: center;
            padding: 0 40px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            transition: background 0.3s ease;
            position: relative;
            z-index: 10;
            gap: 25px;
        }

        .container .navbar a {
            display: inline-block;
            padding: 12px 20px;
            color: white;
            font-size: 18px;
            font-weight: 500;
            text-decoration: none;
            text-align: center;
            transition: all 0.3s ease;
            border-radius: 8px;
            position: relative;
        }

        .container .navbar a:hover {
            background-color: #9acd32;
            transform: translateY(-2px);
        }

        .container .navbar a.active {
            box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
            background-color: rgba(255, 255, 255, 0.1);
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* 新增内容区域样式（重点修改部分） */
        .main-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 40px 20px;
            /* 使用 flex 布局实现平铺 */
            display: flex;
            flex-wrap: wrap; /* 允许换行 */
            gap: 32px; /* 卡片间距 */
        }

        .function-cards {
            /* 移除原有 grid 布局，改用 flex 自适应 */
            width: 100%;
        }

        .function-card {
            background: white;
            border-radius: 16px;
            box-shadow: 0 8px 24px rgba(0, 132, 255, 0.1);
            padding: 32px;
            margin-bottom: 32px;
            animation: fadeIn 0.6s ease-out;
            /* 弹性盒子属性，实现平铺 */
            flex: 1; /* 等比例扩展 */
            min-width: 300px; /* 最小宽度防止卡片过小 */
        }

        .card-title {
            font-size: 24px;
            font-weight: 600;
            color: #0066cc;
            border-bottom: 3px solid #0084ff;
            padding-bottom: 8px;
            margin-bottom: 24px;
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-group label {
            display: block;
            font-size: 16px;
            color: #333;
            margin-bottom: 8px;
        }

        .form-input {
            width: 100%;
            padding: 12px;
            border: 2px solid #e0e8f2;
            border-radius: 8px;
            font-size: 16px;
            transition: border-color 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: #0084ff;
        }

        .action-btn {
            width: 100%;
            padding: 14px;
            background-color: #0084ff;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        .action-btn:hover {
            background-color: #0066cc;
        }

        .query-result {
            margin-top: 24px;
            padding: 16px;
            background-color: #f8f9fa;
            border-radius: 8px;
            font-size: 16px;
            color: #666;
        }

        /* 响应式布局优化 */
        @media (min-width: 768px) {
            .function-card {
                min-width: 400px; /* 提高中等屏幕卡片宽度 */
            }
        }

        @media (min-width: 1024px) {
            .function-card {
                flex: 0 0 calc(50% - 16px); /* 大屏幕下两列布局 */
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <!-- 导航栏保持不变 -->
        <div class="navbar">
            <a href="/MainPagehtml/MainPage.html">首页</a>
            <a href="/analysis">情感分析</a>
            <a href="/MainPagehtml/CorpusImport.html">语料导入</a>            
            <a href="/MainPagehtml/CorpusModify.html">语料修改</a>
            <a href="/MainPagehtml/CorpusQuery.html">语料查询</a>
            <a href="/MainPagehtml/userModelCorpus.html">模型语料</a>
        </div>
    </div>

    <div class="main-content">
        <div class="function-cards">
            <!-- 语料查询卡片 -->
            <div class="function-card">
                <h2 class="card-title">语料查询</h2>
                <div class="form-group">
                    <label>查询关键词</label>
                    <input type="text" id="queryKeyword" class="form-input" placeholder="输入关键词（如：情感词、主题词）">
                </div>
                <button class="action-btn" onclick="performQuery()">开始查询</button>
                <div id="queryResult" class="query-result"></div>
            </div>
        </div>
    </div>

    <script>
        // 保持导航栏激活状态逻辑不变
        const currentUrl = window.location.href;
        const navLinks = document.querySelectorAll('.navbar a');
        navLinks.forEach(link => {
            if (currentUrl.includes(link.getAttribute('href'))) {
                link.classList.add('active');
            }
        });


        // 模拟查询功能
        function performQuery() {
            const keyword = document.getElementById('queryKeyword').value.trim();
            if (!keyword) {
                alert('请输入关键字！');
                return;
            }

            $.ajax({
                method: 'Post',
                url: '/querycorpus',
                dataType: 'json',
                contentType: 'application/json;charset=utf-8',
                data: JSON.stringify({
                    'keyword': keyword
                }),
                success: function(data) {
                    const result = `
                    <p>查询关键词：${keyword}</p>
                    <p>模拟查询结果：</p>
                    <ul> 
                        <li>语料ID+内容：${data.status}</li>
                    </ul>
                 `;
                    document.getElementById('queryResult').innerHTML = result;
                }
            });
        }

    </script>
</body>

</html>
